package br.com.yaba.dbs;

import br.com.yaba.dbs.FileBackupException;
import java.io.File;
import java.util.Map;

/**
 *
 * @author YABA
 */
public interface Client {

	/**
	 * Sends a file (its bytes) to be backuped at the DBS!
	 * @param userId The identifier for the file's owner. The identifier is permanentelly
	 * associated with the backuped file, and needs to be provided for its recovery process.
	 * @param filePath The operating system file path.
	 * @return the generated fileId for the backuped file.
	 * @throws FileBackupException Used to encapsulate any error at the backuping process.
	 */
	public String put( String userId, String filePath ) throws FileBackupException;

	/**
	 * Recovers a backuped file from the DBS!
	 * @param userId The identifier for the file's owner. The identifier needs to be
	 * the same used a the backuping (PUT) process.
	 * @param fileId Every time a file is backuped an ID is generated. This ID is required
	 * here.
	 * @param filePath A path were the file will be stored.
	 * @return If the process is finished without problem, a File object pointing to the
	 * file that was created to store the recovered bytes.
	 * @throws FileBackupException Used to encapsulate any error at the backuping process.
	 */
	public File get( String userId, String fileId, String filePath ) throws FileBackupException;

	/**
	 * Returns a map where the KEY has the backuped file name, and the VALUE has the backuped
	 * fileId.
	 * @param userId The identifier for the files' owner.
	 * @return a map where <KEY,VALUE> = <backuped file name, backuped fileId>
	 */
	public Map<String,String> getBackupedIds( String userId );
}
